package org.querycreator.entity;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Entity used for testing the classes
 * 
 * @author Luciano Molinari
 *
 */
public class Customer {

	private String name;	
	private Date dateOfBorn;
	private String state;	
	private Double salary;
	
	public Customer() { }
	
	public Customer(String name, Date dateOfBorn, String state, Double salary) {
		this.name = name;
		this.dateOfBorn = dateOfBorn;
		this.state = state;
		this.salary = salary;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getDateOfBorn() {
		return dateOfBorn;
	}

	public void setDateOfBorn(Date dateOfBorn) {
		this.dateOfBorn = dateOfBorn;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public Double getSalary() {
		return salary;
	}

	public void setSalary(Double salary) {
		this.salary = salary;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(!(obj instanceof Customer)) {
			return false;
		}
		Customer anCustomer = (Customer) obj;
		return (name.equals(anCustomer.getName()) && dateOfBorn.equals(anCustomer.getDateOfBorn()) &&
				state.equals(anCustomer.getState()) && salary.equals(anCustomer.getSalary()));
	}

	@Override
	public String toString() {
		return "[Name: " + name + "; DOB: " + SimpleDateFormat.getDateInstance().format(dateOfBorn) + "; State: " +
			state + "; Salary: " + salary;
	}
	
}